package com.pg.controller.rz;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pg.entity.rz.EipDataSynchronizationInfo;
import com.pg.service.EipDataSynchronizationInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;
/**
 * <p>
 * 日志前端控制器
 * </p>
 *
 * @author zhanghongbin
 * @since 2020-05-26
 */
@Api(tags = "日志")
@RestController
@RequestMapping("/eipDataSynchronizationInfo")
public class EipDataSynchronizationInfoController extends JeecgController<EipDataSynchronizationInfo, EipDataSynchronizationInfoService> {

    @Autowired
    private EipDataSynchronizationInfoService eipDataSynchronizationInfoService;

    /**
     * 分页列表查询
     *
     * @param eipDataSynchronizationInfo     日志详情
     * @param synchronizationDateStartBegin  起始时间
     * @param synchronizationDateStartFinish 结束时间
     * @param pageNo                         起始页
     * @param pageSize                       每页条数
     * @param req                            参数
     * @return 分页数据
     */
    @ApiOperation("分页列表查询 日志")
    @AutoLog(value = "LogManagement")
    @RequestMapping(method = RequestMethod.GET, value = "/selectForList")
    public Result<?> selectForList(
            EipDataSynchronizationInfo eipDataSynchronizationInfo,
            @RequestParam(name = "synchronizationDateStartBegin", defaultValue = "") @DateTimeFormat(pattern = "yyyy-MM-dd") Date synchronizationDateStartBegin,
            @RequestParam(name = "synchronizationDateStartFinish", defaultValue = "") @DateTimeFormat(pattern = "yyyy-MM-dd") Date synchronizationDateStartFinish,
            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
            HttpServletRequest req) {
        Page<EipDataSynchronizationInfo> page = new Page<EipDataSynchronizationInfo>(pageNo, pageSize);
        IPage<EipDataSynchronizationInfo> pageList = eipDataSynchronizationInfoService.selectForList(page, eipDataSynchronizationInfo, synchronizationDateStartBegin, synchronizationDateStartFinish);
        return Result.ok(pageList);
    }

}
